package com.cxb.serviceorder.controller;

import com.cxb.internalcommon.dto.OrderInfo;
import com.cxb.serviceorder.mapper.OrderInfoMapper;
import com.cxb.serviceorder.service.OrderInfoService;
import org.aspectj.weaver.ast.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class testController {

    @GetMapping("/test")
    public String test(){
        //System.out.println("启动成功");
        return "test..";
    }

    @Autowired
    private OrderInfoMapper orderInfoMapper;
    @Autowired
    private OrderInfoService orderInfoService;

    @Value("${server.port}")
    String port;
    //测试派单服务
    @GetMapping("/test-real-order/{orderId}")
    public String dispatch(@PathVariable("orderId")long orderId){

        System.out.println("service-order端口:"+port +"并发测试:orderId"+orderId);
        OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
        orderInfoService.dispatchRealTimeOrder(orderInfo);
        return "test-real-time success";
    }
}
